#include <iostream>
using namespace std;

class A
{
public:
	virtual void fun()
	{
		cout << "a" << endl;
	}
};

class B : public A
{
public:
	virtual void fun()
	{
		cout << "b" << endl;
	}
};

void f(A& x)
{
	x.fun();
}

int main()
{
	A a;
	B b;
	
	f(a);
	f(b);
	return 0;
}